#include <stdio.h>
#include <string.h>
#include <stdlib.h>


int main(){

	int h,m,s,c;
	double	razao = (double)(10*100*100)/(24*60*60); 
	int temp;

	while(scanf( "%2d%2d%2d%2d", &h, &m, &s, &c ) != EOF ){		
		temp = h*60*60*100 + m *60*100 + s * 100 +c;
		printf("%07d\n", (int)(temp*razao)); 

	}
	return 0;
}
